home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / FILEIDZ.422 < prev    next >
Text File  |  1993-04-04  |  7KB  |  205 lines

  1. COMPLETE FLEIDZ13.MOD (read in FILE_ID/DESC.SDI as desc)
  2. David Morse #116 @8315
  3. 1Sunday, 2March 328, 51993 7@ 1 86:149 7pm 2EST
  4.  
  5.  
  6. ┌────────────────────────────────────────────────────────────────────────────┐
  7. │ Mod Name:        FLEIDZ13.MOD           Mod Author: Etheral Cereal         │
  8. │ Difficulty:      ██▒▒▒▒▒▒▒▒             Mod Updated by: David Morse        │
  9. │ WWIV Versions:   4.21a/4.22             Date:  March 28th, 1993            │
  10. │ Affected Files:  XFER.C, BBS.C, BATCH.C, FILEIDZ.C                         │
  11. │ Version:         1.3 (COMPLETE version)                                    │
  12. │ Steps:           4                                                         │
  13. │ Description:     This is a small but USEFUL update to Etheral Cereal's     │
  14. │                  fantastic mod. It eliminates the need for TWO extraction  │
  15. │                  commands by comibing DESC.SDI and FILE_ID.DIZ on the      │
  16. │                  extract command line (thus making the mod about 2 times   │
  17. │                  faster! :) )                                              │
  18. └────────────────────────────────────────────────────────────────────────────┘
  19.  
  20. Note from David:
  21.  
  22. This is a slimmed-down version of 1.2, in that it doesn't contain a page-full
  23. of comments by Etheral Cereal. Basically, this mod will read in FILE_ID.DIZ
  24. or DESC.SDI as the description as soon as an archived file is uploaded.
  25. For boxes, it will not look aligned correctly, but hey, thems the breaks.
  26. My changes are in FILEIDZ.C marked by a "// DM" line.
  27.  
  28. I DEFINITELY did not write this; I just streamlined the extraction
  29. commands making it a LOT faster (esp when using the //CHECKIDZ on multiple
  30. directories!). If upgrading from 1.2, skip down to Step 4 and re-read
  31. "void fileidz".
  32.  
  33. Etheral's net address is no longer in the net, so I went ahead and posted
  34. this (I'm sure he doesn't mind <g>).
  35. ───────────────────────────────────────────────────────────────────────────────
  36.  
  37. /***********************/
  38. /*     L E G E N D     */
  39. /***********************/
  40. /* - = Deleted Line    */
  41. /* + = New Line        */
  42. /* # = Existing Line   */
  43. /* ! = Modified Line   */
  44. /* * = Search For Line */
  45. /***********************/
  46.  
  47.  
  48. Step #1  -- XFER.C (v4.21a)
  49. Function -- void upload(int dn)
  50. Comments --
  51.  
  52.      Just an insert.  No biggie.
  53.  
  54. #            ++thisuser.uploaded;
  55. #            thisuser.uk += ((l+1023)/1024);
  56. +            fileidz(&u,dn);             /* MOD */
  57. #          } else
  58. #            u.numbytes=0;
  59.  
  60.  
  61. Step #2  -- BBS.C (v4.21a)
  62. Function -- void dlmainmenu(void)
  63. Comments --
  64.  
  65.      Put this in right before the REN command [(strcmp(s,"REN")==0)].
  66.      This will allow you to check one entire directory of previously
  67.      uploaded files for FILE_ID.DIZ and DESC.SDI files.  In general,
  68.      this command will lose it's value after its first usage.
  69.      Recommendation before using: Turn Off Pause!
  70.  
  71. +   if ((strcmp(s,"CHECKIDZ")==0) && (dcs()))               /* MOD */
  72. +     check_idz();
  73.  
  74. Step #3  -- BATCH.C (v4.21a)
  75. Function -- void uploaded(char *fn, long cps)
  76. Comments --
  77.  
  78.           Just slip this in for Batch Uploads support.
  79.  
  80. #              }
  81. #            }
  82. #            if (d1>=0) {
  83. +              fileidz(&u,batch[i1].dir);             /* MOD */
  84. #              u.numbytes = filelength(d1);
  85. #              close(d1);
  86.  
  87.  
  88. Step #4  -- FILEIDZ.C (v1.2)
  89. Function -- N/A
  90. Comments --
  91.  
  92.      This needs to get inserted into your MAKEFILE or your project file
  93.      if you are one of those IDE-type people (and, no, not the hard drive).
  94.      I recommended overlaying it, but will work just fine without it.
  95.      Be sure to look at the beginning of the file to make the appropriate
  96.      changes...
  97.  
  98.      (NOTE from David: The changes from 1.2 are in "void fileidz" so just
  99.      re-read that in if upgrading.)
  100.  
  101. /******************************************************************************
  102.                                    FILEIDZ.C
  103.                                a modification by
  104.                                 Ethereal Cereal
  105.  
  106. PURPOSE : To give WWIV a way to read in FILE_IDZ.DIZ and DESC.SDI's into
  107.           the extended description.
  108. VERSION : v1.3
  109. COMMENTS: Suggested by Rockett 1@6869, Icenet.
  110.  
  111. ******************************************************************************/
  112.  
  113.  
  114.  
  115. #include "vars.h"
  116.  
  117. #pragma hdrstop
  118.  
  119. #define SETREC(i)  lseek(dlf,((long) (i))*((long)sizeof(uploadsrec)),SEEK_SET);
  120.  
  121. /* Uncomment next line if you don't have this defined in VARDEC.H like I do. */
  122. /* #define MAX_LINES 10 */
  123.  
  124. void fileidz(uploadsrec *u,int dn)
  125. {
  126.   char *extbuf=NULL,run_me[81],s[81],s2[81],*ss;
  127.   int f,i;
  128.  
  129.   //extract FILE_ID.DIZ
  130.  
  131.   cd_to(directories[dn].path);
  132.   get_dir(s2,1);
  133.   strcat(s2,stripfn(u->filename));
  134.   cd_to(cdir);
  135.   get_arc_cmd(run_me,s2,1,"FILE_ID.DIZ DESC.SDI");   // <DM> Add DESC.SDI
  136.   cd_to(syscfg.tempdir);
  137.   do_external(run_me,0);     // this puts us back in root on return
  138.   sprintf(s,"%sFILE_ID.DIZ",syscfg.tempdir);
  139.   if (!exist(s))                                     // <DM> Major change,
  140.     sprintf(s,"%sDESC.SDI",syscfg.tempdir);          // whole chunk deleted
  141.  
  142.   if (exist(s)) {
  143.     npr("Reading in %s as extended description...",s);
  144.     ss=read_extended_description(u->filename);
  145.     if (ss) {
  146.       farfree(ss);
  147.       delete_extended_description(u->filename);
  148.     }
  149.     // read in the file id
  150.     if ((extbuf=malloca((long)MAX_LINES*1024))==NULL)
  151.       return;
  152.     f=open(s,O_RDWR | O_BINARY);
  153.     if (filelength(f)<(MAX_LINES*1024)) {
  154.       read(f,extbuf,(int) filelength(f));
  155.       (extbuf)[filelength(f)]=0;
  156.     } else {
  157.       read(f,extbuf,(int)MAX_LINES*1024);
  158.       (extbuf)[(int)MAX_LINES*1024]=0;
  159.     }
  160.     close(f);
  161.     ss=strtok(extbuf,"\n");
  162.     sprintf(u->description,"%s\0",ss);
  163.     u->mask &= ~mask_extended;
  164.     ss=strtok(NULL,"\0");
  165.     add_extended_description(u->filename,ss);
  166.     u->mask |= mask_extended;
  167.     farfree(extbuf);
  168.     npr("Done.\r\n");
  169.   }
  170.   unlink(s);
  171.   cd_to(cdir);
  172. }
  173.  
  174. void check_idz(void)
  175. {
  176.   char s[81];
  177.   int i,abort;
  178.   uploadsrec u;
  179.  
  180.   dliscan();
  181.   file_mask(s);
  182.   abort=0;
  183.   num_listed=0;
  184.   printtitle(&abort);
  185.   for (i=1; (i<=numf) && (!abort) && (!hangup); i++) {
  186.     SETREC(i);
  187.     read(dlf,(void *)&u,sizeof(uploadsrec));
  188.     if (compare(s,u.filename))
  189.       fileidz(&u,udir[curdir].subnum);
  190.     SETREC(i);
  191.     write(dlf,(void *)&u,sizeof(uploadsrec));
  192.   }
  193.   closedl();
  194. }
  195.  
  196. // END OF FILEIDZ.C
  197.  
  198. That's it....compile! Any questions can be directed to this address since
  199. EC is nowhere to be found.
  200. 1
  201. 27─────────────═════════════ 1T2he 1T2rading 1P2ost 7[1SOUTH7] ═════════════──────────────0
  202. 31Columbia, S.C. 2- 5(803) 731-0690 2-3 USR DS 16.8 2- 1WOMRable7 2- 3ASV 2- 7Icenet Support0
  203. 47              5WWIVNet7/3AdventNet7/4ICENet7 1@28315 6-1 FidoNet 21:376/126 0
  204. 5
  205.